<template>
    <h3>显示借款信息</h3>
    借款款项名称
    <input type="text" v-model="searchinfo.JName">
    <select>
            <option value="--请选择--">请选择</option>
                <option value="一年2.1">一年2.1</option>
                <option value="两年2.4">两年2.4</option>
                <option value="三年3.6">三年3.6</option>
            </select>

    <input type="button" value="查询" @click="Show">
  
    <table border="1">
        <thead>
            <tr>
                <th>借款款项编号</th>
                <th>借款款项名称</th>
                <th>借款最高金额</th>
                <th>借款最高年限</th>
                <th>利息</th>
              
                <th>借款款项简介</th>
                <th>操作</th>
            </tr>
           
        </thead>


        <tbody>
           <tr v-for="item in info">
            <td>
                {{item.Jid}}
            </td>
            <td>
                {{item.JName}}
            </td>
            <td>
                {{item.JMaxPrice}}
            </td>
            <td>
                {{item.JMaxYear}}
            </td>
            <td>
                {{item.Lixi}}
            </td>
            <td>
                {{item.JAbstract}}
            </td>
            <td>
                <a href="" @click="UpInfo">修改</a>
                <a href="" @click="DelInfo">删除</a>
            </td>
           
           </tr>

        </tbody>
    </table>
</template>

<script setup lang="ts">
 import {ref,onMounted} from 'vue';
 import axios from 'axios';

const info=ref({
    Jid:"",
    JName:"",
    JMaxPrice:"",
    JMaxYear:"",
    Lixi:"",
    JAbstract:"",
})


const searchinfo=ref({
    JName:""
})


//显示
onMounted(()=>{
    Show();
})


const DelInfo=()=>{
    if(confirm("确定要删除吗")){
        alert("删除成功")
    }
}

const UpInfo=()=>{
   location.href = '/UpJMoney'
}

const Show=()=>{
    axios.get("http://localhost:4743/api/API/Show",{
        params:{
            JName:searchinfo.value.JName
        }
    })
    .then(res=>{
        info.value=res.data;
    })
}

</script>